<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
<%@ include file="../include/top.jsp"%>
<%@ include file="../include/errorArea.jsp"%>
<%@ include file="../include/message-save.jsp" %>
<script type="text/javascript">
	function preCreateTreeNode(treeId){
		$.layer({
		    type: 2,
		    maxmin: true,
		    shadeClose: true,
		    title: '添加服务节点',
		    shade: [0.1,'#fff'],
		    offset: [($(window).height() / 15)+'px',''],
		    area: ['600px', '400px'],
		    iframe: {src: '${ctx}/communityService/addNode/'+treeId}
		}); 
	}
	
	function showAllNode(treeId){
		/* $("#searchForm").attr('${ctx}/sortTree/listAllNode?treeId='+treeId);
		$("#searchForm").submit(); */
		 document.searchForm.action = '${ctx}/sortTree/listAllNode?treeId=' + treeId;
         document.searchForm.submit();
	}
	
	function updateNode(id){
		/* $("#searchForm").attr('${ctx}/sortTree/listAllNode?treeId='+treeId);
		$("#searchForm").submit(); */
		/*  document.searchForm.action = '${ctx}/communityService/editNode/' + id;
         document.searchForm.submit(); */
        $.layer({
 		    type: 2,
 		    maxmin: true,
 		    shadeClose: true,
 		    title: '修改服务节点',
 		    shade: [0.1,'#fff'],
 		    offset: [($(window).height() / 15)+'px',''],
 		    area: ['600px', '400px'],
 		    iframe: {src: '${ctx}/communityService/editNode/'+id}
 		}); 
	}
	
	//点击删除一条记录
	/* function openDeleteDialog(id){
		/* var str ="确实要删除这条记录吗？";
		layer.confirm(str, function(){
			window.location.href = "${ctx}/sortTree/deleteNode/" + id;
		});
		 */
		//点击删除一条记录
   	function openDeleteDialog(id){
		var str ="确定要删除该条记录吗？";
   		layer.confirm(str,function(){
   			$.ajax({
				url:'${ctx}/communityService/deleteNode/'+id,
				type:'POST',
				cache:false,
				success:function(data){
					location.reload();
				}
			});
   		});
	 }
   	function clickSS(){
		document.getElementById("Image8").click(); 
		$("#Image8").click();
	}
   	
   	$(document).ready(function(){
		
		var tablename=document.getElementById("listOutTable");
		var li=tablename.getElementsByTagName("tr");
		for (var i=1;i<=li.length;i++){
		if (i%2==0){
		li[i].style.backgroundColor="#f6f6f6";
		}else li[i].style.backgroundColor="#FFFFFF";
		}

	});
</script>
</head>

<body>
<form id="searchForm" name="searchForm" action="" method="get">
<div class='adduser'>
	<div class='adduser-left'><div class='adduser-icon'></div><span>服务分类</span></div>
</div>
<div class='querycondition'>
	<div class='condtiontitle'><div class='searchcondition'></div>搜索条件：</div>
	<div class='condtion'>
		节点名称：<input type="text" name="name" value="${formdata.name}" size="15" />
        &nbsp;&nbsp;&nbsp;节点代码：<input type="text" name="code" value="${formdata.code}" size="15" />
        <input name="image" style="display:none" type="image" id="Image8" onmouseover="MM_swapImage('Image8','','${baseURL}/images/button_ss_a.jpg',1)" onmouseout="MM_swapImgRestore()" src="${baseURL}/images/button_ss.jpg"/>
	    <%-- <img src="${baseURL}/images/button_qk.jpg" name="clearButton" id="clearButton" style="cursor:pointer" onclick="clearInput()" onmouseover="MM_swapImage('clearButton','','${baseURL}/images/button_qk_a.jpg',1)" onmouseout="MM_swapImgRestore()"/>  --%>
		
		<input type='button' value='搜索'  class='button cyan medium' onclick="clickSS();"/>&nbsp;&nbsp;
		<input type='button' value='清空' class='button cyan medium' onclick="clearInput()"/>&nbsp;&nbsp;
		<input type="button" value="添加服务节点" class='button cyan medium' onclick="preCreateTreeNode(${formdata.treeId});"/>&nbsp;&nbsp;
        <input type="button" value="全部节点" class='button cyan medium' onclick="showAllNode(${formdata.treeId});"/>&nbsp;&nbsp;
	</div>
</div>


<%-- <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td height="5" colspan="2"></td>
  </tr>
	<input type="hidden" name="p" value="1" />
	<input type="hidden" name="treeId" value="${formdata.treeId}" />
    <tr>
      <td height="20" align="left" valign="middle">&nbsp;&nbsp;<img src="${baseURL}/images/009.png" width="16" height="16" align="absmiddle" />&nbsp;搜索条件：&nbsp;节点名称：
        <input type="text" name="name"
			value="${formdata.name}" size="15" />
        &nbsp;&nbsp;&nbsp;节点代码：
        <input type="text" name="code"
			value="${formdata.code}" size="15" /></td>
      <td width="25%" align="left" valign="middle" class="STYLE6"><input name="image" type="image" id="Image8" onmouseover="MM_swapImage('Image8','','${baseURL}/images/button_ss_a.jpg',1)" onmouseout="MM_swapImgRestore()" src="${baseURL}/images/button_ss.jpg"/>
      <img src="${baseURL}/images/button_qk.jpg" name="clearButton" id="clearButton" style="cursor:pointer" onclick="clearInput()" onmouseover="MM_swapImage('clearButton','','${baseURL}/images/button_qk_a.jpg',1)" onmouseout="MM_swapImgRestore()"/></td>
    </tr>
  <tr>
    <td height="5" colspan="2"></td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#A6CAE8"></td>
  </tr>
  <tr>
    <td height="5" colspan="2" class="text_gray2"></td>
  </tr>
</table> --%>
</form>
<script>
	function clearInput() {
		searchForm.name.value = "";
		searchForm.code.value = "";
	}
</script>

<c:if test="${empty obj.list}">
<div align="center"><b>没有符合条件的记录。</b></div>
</c:if>

<c:if test="${not empty obj.list}">
<div class='userlist-title'>
	<div class='userlist-title-left'><div class='userlist-title-icon'></div><span>服务分类</span></div>
</div>
<div class='userlist'>
<table width="94%" align="center" cellpadding=0 cellspacing=0 id="listOutTable">
	<tr align="center" class='userlist-tr-title'>
		<td class='userlist-td operation' width="30%">节点名称</td>
		<td class='userlist-td operation' width="12%">节点代码</td>
		<td class='userlist-td operation' width="30%">父节点</td>
		<td class='userlist-td operation' width="10%">标准数量</td>
		<td class='userlist-td operation'>操作</td>
	</tr>
	<c:forEach var="oneRow" items="${obj.list}">
		<tr class='userlist-tr-content' align="center">
			<td align="left" class='userlist-td'>${oneRow.levelName}</td>
			<td class='userlist-td'>${oneRow.code}</td>
			<td class='userlist-td'>${oneRow.pName}</td>
			<td class='userlist-td'>0</td>
			<td class='userlist-td'>
			<a href="#" onclick="updateNode(${oneRow.id});">编辑</a>
			<a href="#" onclick="openDeleteDialog(${oneRow.id});">删除</a> </td>
		</tr>
	</c:forEach>
	
</table>
<table>
	<tr>
	    <td colspan="5"><%@ include file="../include/listpage.jsp"%>
	    </td>
 	</tr>
</table>
</div>
<script>
	function openLinkWin(nodeId) {
		url = "linkStand.nut?isLink=N&nodeId="+nodeId;
		window.open(url, "linkWin", "width=800,height=600");
	}
</script>
</c:if>
<%@ include file="../include/bottom.jsp"%>
</body>